package com.example.template.core.utils;
/**
 * Description:
 * Created by Meko on 2019/3/2821:09
 * Version 1.0
 */

import java.util.Random;

/**
 * @ClassName SimpleStringUtils
 * @Description TODO
 * @Date 2019/3/28 21:09
 **/
public class SimpleStringUtils {

    public static String getFixLenthString(int strLength) {

        Random rm = new Random();

        // 获得随机数
//        double pross = (1 + rm.nextDouble()) * Math.pow(10, strLength);
        double pross = rm.nextDouble();

        // 将获得的获得随机数转化为字符串
        String fixLenthString = String.valueOf(pross);

        // 返回固定的长度的随机数
        return fixLenthString.substring(2, strLength + 2);
    }
}
